﻿using Anke.SHManage.BLL;
using Anke.SHManage.MSSQLDAL;
using Anke.SHManage.MSSQLDAL.TJDAL;
using Anke.SHManage.Web.Reports.DataSetForPrintTableAdapters;
using Microsoft.Reporting.WebForms;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Anke.SHManage.Web.Reports
{
    public partial class TJ_DDGZQKModeWebForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitPage();
            }
        }
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            BindReportDataSource();

        }
        private void InitPage()
        {
            this.StartDate.Text = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 07:30:00");
            this.EndDate.Text = DateTime.Now.ToString("yyyy-MM-dd 07:30:00");
            BindReportDataSource();
        }

        protected void BindReportDataSource()
        {

            DateTime beginTime = Convert.ToDateTime(this.StartDate.Text);
            DateTime endTime = Convert.ToDateTime(this.EndDate.Text);
            //string txtCenter = Convert.ToString(this.Center.Text);
            //string stationID = Convert.ToString(this.Station.Text);
            //string type = (this.Type.Value);

            string start1 = beginTime.ToString();
            string end1 = endTime.ToString();
            //string type1 = (this.Type.Value).ToString();

            this.ReportViewer1.LocalReport.DataSources.Clear();
            this.ReportViewer1.LocalReport.ReportPath = Server.MapPath(@"~/Reports/TJ_DDGZQK.rdlc");
            Microsoft.Reporting.WebForms.ReportParameter st = new Microsoft.Reporting.WebForms.ReportParameter("StartTime", start1);
            Microsoft.Reporting.WebForms.ReportParameter ed = new Microsoft.Reporting.WebForms.ReportParameter("EndTime", end1);
            //Microsoft.Reporting.WebForms.ReportParameter ty = new Microsoft.Reporting.WebForms.ReportParameter("type", type1);
            this.ReportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter[] { st, ed});
            string eventDispatchCenterID = UserOperateContext.Current.Seesion_Dispatch_SubCenterID; //2020-11-22 zch 登录人所处急救中心
            TJDAL dal = new TJDAL();
            DataTable dt = dal.Get_TJ_DDGZQK(beginTime, endTime, eventDispatchCenterID);

            this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSetForTJ_DDGZQK", dt));
            this.ReportViewer1.LocalReport.Refresh();
        }
      
    }
}